package br.elsa.survey.view.beans;

import java.io.Serializable;
import java.security.InvalidParameterException;

import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Named;

import br.elsa.survey.domain.questions.CheckboxQuestion;
import br.elsa.survey.domain.questions.Question;

@Named
@SessionScoped
public class QuestionEditorHandler implements Serializable {

	private Question question;
	
	public String selectQuestionToEdit(Question question) {
		
		if (question instanceof CheckboxQuestion) {
			
			this.question = question;
			return "editCheckboxQuestion";
		}
		
		throw new InvalidParameterException("Invalid question");
	}

	public Question getQuestion() {
		return question;
	}
	
}
